<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		
		<meta charset="utf-8" />
		<title></title>
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="<%=contextPath %>/static/css/bootstrap.min.css" rel="stylesheet" />
		<link href="<%=contextPath %>/static/css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="<%=contextPath %>/static/css/font-awesome.min.css" />
		<link rel="stylesheet" href="<%=contextPath %>/static/css/ace.min.css" />
		<link rel="stylesheet" href="<%=contextPath %>/static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="<%=contextPath %>/static/css/ace-skins.min.css" />
		<script type="text/javascript" src="<%=contextPath %>/static/js/jquery-1.7.2.js"></script>
		<!-- ajax表单提交-->
		<script src="<%=contextPath %>/js/jquery.form.js"></script>
		<!--提示框-->
		<script type="text/javascript" src="<%=contextPath %>/static/js/jquery.tips.js"></script>
		
<script type="text/javascript">
	
	top.hangge();
	
	//保存
	function save(){
		if($("#roleName").val()==""){
			$("#roleName").tips({
				side:3,
	            msg:'请输入角色名称',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#roleName").focus();
			return false;
		}
			$("#zhongxin").hide();
			$("#zhongxin2").show();
			
			$("#form1").ajaxSubmit({
	        	url:'<%=contextPath %>/role/edit',
	        	type:'post',
	        	dataType:"json",
	        	success:function(data){
	        		if(data.code==200){
	        			top.Dialog.close();
	        		}else{
	        			alert("错误");
	        			$("#zhongxin").show();
	        			$("#zhongxin2").hide();
	        		}
	        	}
	      }); 
	}
	
</script>
	</head>
<body>
		<form action="role/edit.do" name="form1" id="form1"  method="post">
		<input type="hidden" name="id" id="id" value="${role.id}"/>
			<div id="zhongxin">
			<table>
				<tr>
					<td><input type="text" name="name" id="roleName" value="${role.name}" placeholder="这里输入名称" title="名称" /></td>
				</tr>
				<tr>
					<td><input type="text" name="description" id="roleName" value="${role.description}" placeholder="这里输入描述" title="描述" /></td>
				</tr>
				<tr>
					<td>
						<select name="role_type"  class="form-control"  >
						  <c:forEach items="${fns:getDictList('role_type')}" var="temp1">
								<option value="${temp1.value }" <c:if test="${temp1.value ==role.roleType }">selected=selected</c:if>>${temp1.valueName }</option>
							</c:forEach>
	                   </select>
					</td>
				</tr>
				<tr>
					<td style="text-align: center;">
						<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
						<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					</td>
				</tr>
			</table>
			</div>
		</form>
	
	<div id="zhongxin2" class="center" style="display:none"><img src="<%=contextPath %>/static/images/jzx.gif"  style="width: 50px;" /><br/><h4 class="lighter block green"></h4></div>
</body>
</html>
